

<div class='mypg_left_out'><? include("inbox_left.php");?></div>

<div class='fullbox_out'>
<?php include_once "my_swapen_merchant.php";?>

<div id='panel'>

<div class="fulldiv" style="width:700px;">

<div class="fulldiv" style="margin:10px 0px 0px 0px;">
 	<div style="float:left; margin:0px 10px 0px 10px;"><strong class="orangehead">Inbox</strong></div>
</div>

<div class="fulldiv">
	<div class="greytab_out" style="float:left; margin:10px 5px -6px 10px;">
		<div class="greytab_left">&nbsp;</div>
		<div class="greytab_repeat">Delete</div>
		<div class="greytab_right">&nbsp;</div>
	</div>
</div>

<div class="fullbox_top">&nbsp;</div>
<div class="fullbox_repeat" >

<div class="fulldiv">

	<div class="mail_out">
		<div class="blue_inbox_box">
				<div class="bluebar_inbox_left"></div>
				<div class="bluebar_inbox_center">
					<div style="width:40px;" class="inbox_head1">&nbsp;</div>
					<div style="width:200px;" class="inbox_head1">From</div>
					<div style="width:300px;" class="inbox_head1">Subject</div>
					<div style="width:100px;" class="inbox_head1">Date</div>
				</div>
				<div class="bluebar_inbox_right"></div>
		</div>
		
		<div class="fulldiv">
			<div class="mail_out2">
				<div style="width:40px;" class="inbox_head1"><input type="checkbox" /></div>
				<div style="width:200px;" class="inbox_head1">Carlinor78</div>
				<div style="width:300px;" class="inbox_head1">Offer received</div>
				<div style="width:100px;" class="inbox_head1">08/15/2010</div>
			</div>
			
			<div class="mail_out2">
				<div style="width:40px;" class="inbox_read"><input type="checkbox" /></div>
				<div style="width:200px;" class="inbox_read">Carlinor78</div>
				<div style="width:300px;" class="inbox_read">Offer received</div>
				<div style="width:100px;" class="inbox_read">08/15/2010</div>
			</div>
		</div>
		
	</div>

</div>

<?php 
if($_GET['delmsg'])
{
mysql_query("delete from tbl_messages where messageid='".$_REQUEST['delmsg']."'");
$_SESSION['msg']="Message Deleted Successfully";
}
if($_POST['Submit'])
{
$chktotal=count($_POST['chkDel']);
if($chktotal>0)
{
for($i=0;$i<$chktotal;$i++)
{
mysql_query("delete from tbl_messages where messageid='".$_POST['chkDel'][$i]."'");
}
$_SESSION['msg']="Message Deleted Successfully";
}
else
{
$_SESSION['msg']="Please select checkbox to delete message(s)";
}
}
$message="select * from tbl_messages where recieverid='".$_SESSION['user_id_sess']."'";
			  $res=mysql_query($message);
			  $nrow=mysql_num_rows($res);
			
			  ?>
<div class="fulldiv">
<form id="form1" name="form1" method="post" action="">
  <table width="100%" border="0" cellpadding="5">
  <?php if($_SESSION['msg'])
  {?>
    <tr>
      <td colspan="5" align="center"><strong><?php echo $_SESSION['msg']; $_SESSION['msg']="";?></strong></td>
      </tr>
	  <?php }?>
    <tr>
	<td>
	
	</td>
      <td>&nbsp;</td>
      <td><strong>Sender</strong></td>
      <td><strong>Subject</strong></td>
      <td><strong>Posted Date </strong></td>
      <td><strong>Status</strong></td>
    </tr>
    <?php 
  $i=0;
  while($mrow=mysql_fetch_array($res))
  {
  $i=1;
  if($mrow['senderid']==0)
  {
  $senderuser="Admin";
  }
  else
  {
  $sqlUser="select * from tbl_users where user_id='".$mrow['senderid']."'";
  $resUser=mysql_query($sqlUser);
  $rowUser=mysql_fetch_array($resUser);
  $senderuser=$rowUser['username'];
  }
  ?>
    <tr <?php if($mrow['status']=="1") {?>style="background-color:#CCCCCC;"<?php }?>>
      <td><input name="chkDel[]" type="checkbox" id="chkDel" value="<?php echo $mrow['messageid'];?>" /></td>
      <td><?php echo $senderuser;?></td>
      <td><?php echo $mrow['subject'];?></td>
      <td><?php echo $mrow['posteddate'];?></td>
      <td ><a href="index.php?reply=<?php echo $mrow['messageid'];?>">Reply</a> | <a href="index.php?read=<?php echo $mrow['messageid'];?>">Read</a> | <a href="index.php?inbox&delmsg=<?php echo $mrow['messageid'];?>">Delete</a></td>
    </tr>
    <?php } if($i==0) {?>
    
    <tr>
      <td colspan="5" align="center"><strong>No Messages Found</strong></td>
    </tr>
    <?php } else {?><tr>
      <td colspan="5" align="left"><input type="submit" name="Submit" value="Delete" /></td>
    </tr><?php }?>
  </table>
</form>
</div>

</div>
<div class="fullbox_bot">&nbsp;</div>

</div>
</div>

</div>